import sys

from PyQt4 import QtCore, QtGui

from fogmini import global_objects
from fogmini.application import FogMiniApplication
from fogmini.login import login
from fogmini.tray_icon import SystemTrayIcon

def main():
    global_objects.app = FogMiniApplication(sys.argv)

    base_widget = QtGui.QWidget()
    global_objects.tray = SystemTrayIcon(base_widget)
    global_objects.tray.show()

    # Delay the login to give the system tray icon time to appear.
    QtCore.QTimer.singleShot(1000, login)

    sys.exit(global_objects.app.exec_())
